@php use Illuminate\Support\Facades\Request; @endphp
@extends('layouts.app')

@section('title',isset($category) ? $category->name : '帖子列表页')

@section('content')
    <div class="row">
        <div class="col-md-9">
            @if(isset($category))
                <div class="alert alert-info">
                    {{$category->name}} : {{$category->description}}
                </div>
            @endif
            <div class="card">
                <div class="card-header">
                    <ul class="nav nav-pills">
                        <li class="nav-item">
                            <a class="nav-link {{active_class(!if_query('order','recent'))}}"  href="{{Request::url()}}?order=default">最后回复</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link {{active_class(if_query('order','recent'))}}" href="{{Request::url()}}?order=recent">最新发布</a>
                        </li>
                     </ul>
                </div>
                <div class="card-body">
                    @include('topics._topic_list',['topics'=>$topics])
                    <div class="mt-5 d-flex justify-content-end">
                        {!! $topics->appends(Request::except('pages'))->render() !!}
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-3">
           @include('topics._sidebar')
        </div>
    </div>
@stop
